//品牌管理模块接口
import request from '@/utils/request'
import  type{ TrademarkResponseData,TradeMark } from "./type.ts";
//品牌管理模块接口地址
enum API {
    //获取品牌列表
    TRADEMARK_LIST = '/admin/product/baseTrademark/',
    //添加品牌
    ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
    //更新品牌
    UPDATETRADEMARK_URL = '/admin/product/baseTrademark/update',
    //删除品牌
    DELETE_URL = '/admin/product/baseTrademark/remove/'
}

//品牌列表
export const reqHasTrademark = (page: number, limit: number) => request.get<any,TrademarkResponseData>(API.TRADEMARK_LIST + `${page}/${limit}`)
//新增品牌|修改品牌
export const reqAddOrUpdateTrademark = (data:TradeMark) =>{
        if(data.id){
            return request.put<any,any>(API.UPDATETRADEMARK_URL,data)
        }else{
            return request.post<any,any>(API.ADDTRADEMARK_URL,data)
        }
}
//删除品牌
export const reqDeleteTrademark = (id:number) => request.delete<any,any>(API.DELETE_URL + id)
